package org.jeecg.modules.business.warehouse.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.business.outbound.entity.vo.RepertorySimpleVO;
import org.jeecg.modules.business.warehouse.entity.InspectResultVO;
import org.jeecg.modules.business.warehouse.entity.WmsInReceiptTask;
import org.jeecg.modules.business.warehouse.entity.WmsInReceiptTaskMaterial;
import org.jeecg.modules.business.warehouse.entity.vo.LightRequestHandleInboundAllVO;
import org.jeecg.modules.business.warehouse.entity.vo.LightRequestHandleInboundVO;
import org.jeecg.modules.business.warehouse.entity.vo.WmsInReceiptTaskPageVO;
import org.jeecg.modules.business.warehouse.entity.vo.WmsInReceiptTaskQueryVO;
import org.jeecg.modules.flow.callback.enums.SimpleDocumentTypeEnum;
import org.jeecg.modules.flow.callback.enums.TransferStatusEnum;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 入库任务
 * @Author: jeecg-boot
 * @Date: 2023-07-28
 * @Version: V1.0
 */
public interface IWmsInReceiptTaskService extends IService<WmsInReceiptTask> {

    /**
     * 添加一对多
     *
     * @param wmsInReceiptTask
     * @param wmsInReceiptTaskMaterialList
     */
    public String saveMain(WmsInReceiptTask wmsInReceiptTask, List<WmsInReceiptTaskMaterial> wmsInReceiptTaskMaterialList);

    /**
     * 修改一对多
     *
     * @param wmsInReceiptTask
     * @param wmsInReceiptTaskMaterialList
     */
    public void updateMain(WmsInReceiptTask wmsInReceiptTask, List<WmsInReceiptTaskMaterial> wmsInReceiptTaskMaterialList);

    /**
     * 删除一对多
     *
     * @param id
     */
    public void delMain(String id);

    /**
     * 批量删除一对多
     *
     * @param idList
     */
    public void delBatchMain(Collection<? extends Serializable> idList);

    /**
     * 提交或撤销提交
     *
     * @param wmsInReceiptTaskId
     * @param documentStatus     1:提交 2:撤销
     */
    void commitOrCancelCommit(String wmsInReceiptTaskId, Integer documentStatus);

    /**
     * 根据任务id修改任务状态 1:入库任务 2:出库任务
     *
     * @param id
     */
    void updateStatus(String id, Integer type);
    /**
     * 根据入库单修改任务状态(用于回调bean)
     *
     * @param id
     */
    void updateReceipt(String id);

    void closeTask(String id, Integer type);
    IPage<WmsInReceiptTaskPageVO> listByPage(IPage<WmsInReceiptTask> page, WmsInReceiptTaskQueryVO param);

    void rawOrAuxInspect(InspectResultVO inspectResultVO);

    /**
     * 通过入库任务id 获取物料即时库存位置信息
     * @param taskMaterialId
     * @return
     */
    RepertorySimpleVO getMaterialRepertoryInfoByInId(String taskMaterialId);

    /**
     * 当保存时获取过账状态
     * @return
     */
    TransferStatusEnum getTransferStatusWhenSave(SimpleDocumentTypeEnum simpleDocumentType, String docuemntType);

    /**
     * 更新过账状态
     * @param simpleDocumentType
     * @param taskId
     * @param receiptId
     * @param transferStatus
     */
    void updateTransferStatus(SimpleDocumentTypeEnum simpleDocumentType,String taskId,String receiptId,TransferStatusEnum transferStatus);

    /**
     * 根据物料信息获取进行中的任务id
     * @param wmsBasicMaterialId
     * @param batchCode
     * @return
     */
    List<String> getProcessTaskIdByMaterialInfo(String wmsBasicMaterialId,String batchCode);

    /**
     * pda-开灯/关灯
     * @return
     */
    Result<Void> lightIBSHandleInbound(LightRequestHandleInboundVO vo);
    /**
     * pda-全部开灯/全部关灯
     * @return
     */
    Result<Void> lightIBSHandleInboundAll(LightRequestHandleInboundAllVO vo);
}
